//
// CPackedWorld.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CVector;
import org.ryzom.nel.misc.IStream;

public class CPackedWorld {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CPackedWorld(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CPackedWorld obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CPackedWorld(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void setZoneNames(Vector_String value) {
    nel3dJNI.CPackedWorld_ZoneNames_set(swigCPtr, this, Vector_String.getCPtr(value), value);
  }

  public Vector_String getZoneNames() {
    long cPtr = nel3dJNI.CPackedWorld_ZoneNames_get(swigCPtr, this);
    return (cPtr == 0) ? null : new Vector_String(cPtr, false);
  }

  public void build(SWIGTYPE_p_std__vectorT_TPackedZoneBaseSPtr_t packesZones) {
    nel3dJNI.CPackedWorld_build(swigCPtr, this, SWIGTYPE_p_std__vectorT_TPackedZoneBaseSPtr_t.getCPtr(packesZones));
  }

  public boolean raytrace(CVector start, CVector end, CVector inter, SWIGTYPE_p_std__vectorT_NLMISC__CTriangle_t testedTriangles, CVector normal) {
    return nel3dJNI.CPackedWorld_raytrace__SWIG_0(swigCPtr, this, CVector.getCPtr(start), start, CVector.getCPtr(end), end, CVector.getCPtr(inter), inter, SWIGTYPE_p_std__vectorT_NLMISC__CTriangle_t.getCPtr(testedTriangles), CVector.getCPtr(normal), normal);
  }

  public boolean raytrace(CVector start, CVector end, CVector inter, SWIGTYPE_p_std__vectorT_NLMISC__CTriangle_t testedTriangles) {
    return nel3dJNI.CPackedWorld_raytrace__SWIG_1(swigCPtr, this, CVector.getCPtr(start), start, CVector.getCPtr(end), end, CVector.getCPtr(inter), inter, SWIGTYPE_p_std__vectorT_NLMISC__CTriangle_t.getCPtr(testedTriangles));
  }

  public boolean raytrace(CVector start, CVector end, CVector inter) {
    return nel3dJNI.CPackedWorld_raytrace__SWIG_2(swigCPtr, this, CVector.getCPtr(start), start, CVector.getCPtr(end), end, CVector.getCPtr(inter), inter);
  }

  public void getZones(SWIGTYPE_p_std__vectorT_TPackedZoneBaseSPtr_t zones) {
    nel3dJNI.CPackedWorld_getZones(swigCPtr, this, SWIGTYPE_p_std__vectorT_TPackedZoneBaseSPtr_t.getCPtr(zones));
  }

  public void serial(IStream f) {
    nel3dJNI.CPackedWorld_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public void serialZoneNames(IStream f) {
    nel3dJNI.CPackedWorld_serialZoneNames(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public void select(SWIGTYPE_p_NLMISC__CPolygon2D poly, SWIGTYPE_p_std__vectorT_NLMISC__CTriangle_t selectedTriangles) {
    nel3dJNI.CPackedWorld_select(swigCPtr, this, SWIGTYPE_p_NLMISC__CPolygon2D.getCPtr(poly), SWIGTYPE_p_std__vectorT_NLMISC__CTriangle_t.getCPtr(selectedTriangles));
  }

  public CPackedWorld() {
    this(nel3dJNI.new_CPackedWorld(), true);
  }

}
